from dataclasses import dataclass
from typing import Protocol

from src.application.order.dto.order import OrderDTO
from src.application.order.enums import OrderStatus, OrderType
from src.domain.common.constants import Empty, OrderBy


@dataclass(frozen=True)
class GetOrdersFilters:
    tg_user_id: int | Empty = Empty.UNSET
    offset: int | Empty = Empty.UNSET
    limit: int | Empty = Empty.UNSET
    order_type: OrderType = OrderType.proxy
    order_by: OrderBy = OrderBy.ASC
    order_status: OrderStatus = OrderStatus.active


class OrderReader(Protocol):
    async def get_order_by_id(self, order_id: int) -> OrderDTO:
        raise NotImplementedError

    async def get_orders(self, filters: GetOrdersFilters) -> list[OrderDTO]:
        raise NotImplementedError

    async def get_user_subscription_order(self, tg_user_id: int) -> OrderDTO:
        raise NotImplementedError

    async def get_expiring_orders(self, autorenew: bool = False) -> list[OrderDTO]:
        raise NotImplementedError

    async def get_expired_orders(self) -> list[OrderDTO]:
        raise NotImplementedError
